<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="css/base.css">
	<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
	<title>Document</title>
	<script type="text/javascript">
		$(document).ready(function(){
			$("span").nextUntil("p").css({"color":"red","border":"2px solid red"});

			$("span").prevUntil("p").css({"color":"blue","border":"2px solid blue"});
		});
	</script>
</head>
<body class="siblings">
	<div> div (父)
		<p>p</p>
		<h1>h1</h1>
		<span>span</span>
		<h2>h2</h2>
		<h3>h3</h3>
		<p>p</p>
	</div>	
</body>
</html>